/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            adminPointTaskDetailInfo: {
                details: [],
                inspectionId: '',
                inspectionRouteId:'',
                taskId:'',
                roomNum: '',
                allOweFeeAmount: '0',
                planUserName:'',
                inspectionStartTime:'',
                inspectionEndTime:'',
            }
        },
        _initMethod: function () {
        },
        _initEvent: function () {
            vc.on('adminPointTaskDetail', 'switch', function (_data) {
                $that.adminPointTaskDetailInfo.inspectionId = _data.inspectionId;
                $that.adminPointTaskDetailInfo.taskId = _data.taskId;
                $that.adminPointTaskDetailInfo.inspectionRouteId = _data.inspectionRouteId;
                $that._loadAdminPointTaskDetailData(DEFAULT_PAGE, DEFAULT_ROWS);
                setTimeout(function(){
                    $that._initTaskDetailDate();
                },1000)
            });
            vc.on('adminPointTaskDetail', 'paginationPlus', 'page_event',
                function (_currentPage) {
                    $that._loadAdminPointTaskDetailData(_currentPage, DEFAULT_ROWS);
                });
            vc.on('adminPointTaskDetail', 'notify', function (_data) {
                $that._loadAdminPointTaskDetailData(DEFAULT_PAGE, DEFAULT_ROWS);
            })
        },
        methods: {
            _initTaskDetailDate:function(){
                vc.initDate('pointDetailStartTime',function(_value){
                    $that.adminPointTaskDetailInfo.inspectionStartTime = _value;
                });
                vc.initDate('pointDetailEndTime',function(_value){
                    $that.adminPointTaskDetailInfo.inspectionEndTime = _value;
                })
            },
            _loadAdminPointTaskDetailData: function (_page, _row) {
                let param = {
                    params: {
                        inspectionId: $that.adminPointTaskDetailInfo.inspectionId,
                        inspectionRouteId: $that.adminPointTaskDetailInfo.inspectionRouteId,
                        taskId: $that.adminPointTaskDetailInfo.taskId,
                        planUserName: $that.adminPointTaskDetailInfo.planUserName,
                        inspectionStartTime: $that.adminPointTaskDetailInfo.inspectionStartTime,
                        inspectionEndTime: $that.adminPointTaskDetailInfo.inspectionEndTime,
                        page: _page,
                        row: _row
                    }
                };
                //发送get请求
                vc.http.apiGet('/inspectionTaskDetail.listAdminInspectionTaskDetails',
                    param,
                    function (json) {
                        let _json = JSON.parse(json);
                        $that.adminPointTaskDetailInfo.details = _json.inspectionTaskDetails;
                        vc.emit('adminPointTaskDetail', 'paginationPlus', 'init', {
                            total: _json.records,
                            dataCount: _json.total,
                            currentPage: _page
                        });
                    },
                    function () {
                        console.log('请求失败处理');
                    }
                );
            },
            //查询
            _qureyAdminPointTaskDetail: function () {
                $that._loadAdminPointTaskDetailData(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //重置
            _resetAdminPointTaskDetail: function () {
                $that.adminPointTaskDetailInfo.roomNum = "";
                $that._loadAdminPointTaskDetailData(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            
        }
    });
})(window.vc);